package com.keyinong.parkin.home.adapter;

import java.util.ArrayList;

import com.example.parkin.R;
import com.keyinong.parkin.home.bean.MeetingRoomBean;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ConfrimSelectTimeAdapter extends BaseAdapter {
	Context context;
	ArrayList<MeetingRoomBean> list;

	public ConfrimSelectTimeAdapter(Context context,
			ArrayList<MeetingRoomBean> list) {
		super();
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ViewHanlde handle;
		if (view == null) {
			handle = new ViewHanlde();
			view = LayoutInflater.from(context).inflate(
					R.layout.item_grid_selectconfrimtime, null);
			handle.tv_confrimSelectTime = (TextView) view
					.findViewById(R.id.tv_confrimSelectTime);
			view.setTag(handle);
		} else {
			handle = (ViewHanlde) view.getTag();
		}
		handle.tv_confrimSelectTime.setText(list.get(position).getStart_hour()
				+ "~" + list.get(position).getEnd_hour());
		return view;
	}

	private class ViewHanlde {
		TextView tv_confrimSelectTime;
	}

}
